#include <bits/stdc++.h>
using namespace std;
int n,r[100001],m[100001],tmp;
int main()
{
   freopen("duel.in","r",stdin);
   freopen("duel.out","w",stdout);
    cin>>n;
    int maxn=-0x3f3f3f3f,minn=0x7f7f7f7f;
    for(int x=0;x<n;x++)
    {
        cin>>tmp;
        r[tmp]++;
        m[tmp]++;
        maxn=max(tmp,maxn);
        minn=min(tmp,minn);
    }
    int cnt=r[maxn];

    for(int x=maxn-1;x>minn-1;x--)
    {
        if(r[x]>=cnt)
        {
            n-=cnt;cnt=r[x];
        }
        else {
            n-=r[x];
        }
    }
    cout<<n;
    return 0;
}
